<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta charset="utf-8">
    <title>编辑章节</title>

    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <!-- page specific plugin styles -->
    <script src="__PUBLIC__/admin/js/jquery.min.js"></script>
    <script src="__PUBLIC__/admin/js/lodash.min.js"></script>
    <script src="__PUBLIC__/admin/js/moment.min.js"></script>
    <script src="__PUBLIC__/admin/js/zh-cn.js"></script>
    <script src="__PUBLIC__/admin/js/numeral.min.js"></script>
    <script src="__PUBLIC__/admin/js/toastr.min.js"></script>
    <script src="__PUBLIC__/admin/js/cookies.js"></script>
    <script src="__PUBLIC__/admin/js/knockout-min.js"></script>
    <script src="__PUBLIC__/admin/js/knockout.mapping.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap-datetimepicker.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.unobtrusive.min.js"></script>
    <script src="__PUBLIC__/admin/js/clipboard.min.js"></script>
    <script src="__PUBLIC__/admin/js/select2.min.js"></script>
    <script src="__PUBLIC__/admin/js/admin.js"></script>
    <script>
      moment.locale('zh-cn');
      toastr.options.positionClass = 'toast-bottom-right';
    </script>
    <!-- ace settings handler -->
    <script src="__PUBLIC__/admin/js/ace-extra.min.js"></script>
<link media="all" href="__PUBLIC__/admin/css/index14.css" type="text/css" rel="stylesheet">
</head>
<body class="no-skin">

    <!-- #section:basics/navbar.layout -->
<include file="./Public/gong/title.html" />

    <div class="main-container" id="main-container">
      <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
      </script>

      <div id="sidebar" class="sidebar responsive">
          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
          </script>

<include file="./Public/gong/list.html" />


          <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
            <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
          </div>

          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
          </script>
      </div>

      <!-- /section:basics/sidebar -->
      <div class="main-content">


        <div class="breadcrumbs" id="breadcrumbs">
          <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
          </script>

          <ul class="breadcrumb">
            <li>
              <i class="ace-icon fa fa-home home-icon"></i>
              <a    href="__APP__/Home/Index/index.html">Home</a>
            </li>
            <li class="active">编辑章节</li>
          </ul><!-- /.breadcrumb -->

          <!-- /section:basics/content.searchbox -->
        </div>

        <!-- /section:basics/content.breadcrumbs -->
        <div class="page-content">
          <div class="page-content-area">
            <div class="row">
              <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->

                <!--/span-->
                <!-- left menu ends -->



<div style="margin-bottom: 30px;">
    <ul class="nav nav-tabs">

        <li class="active"><a >编辑章节</a></li>
    </ul>
</div>
<form id="main-form" class="form-horizontal"   method="POST" action="__URL__/do_edit_bookinfo?bid=$bookinfo['bid']" enctype="multipart/form-data">
    <div style="text-align: right;width: 100%;" >
        <a class="btn-block btn" href="{:U('book_share',['bid'=>$bookinfo['bid']])}">返回</a></div>
    <div class="form-group">
        <label class="control-label col-sm-3">书籍名称</label>
        <div class="col-sm-9">
            <select name="bid"  style="height:27px;width:41.6667%;line-height:27px;color:#000;outline:none;" id="s2" readonly="true">
                <option value="{$bookinfo.bid}">{$bookinfo.title}</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">输入章节</label>
        <div class="col-sm-9">
            <input name="number" class="col-sm-5 col-xs-10"  type="text" style="width:39.667%" value="{$bookinfo.number}" onkeyup="value=value.replace(/[^\d]/g,'') " ng-pattern="/[^a-zA-Z]/">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">章节标题</label>
        <div class="col-sm-9">
            <input name="title2" class="col-sm-5 col-xs-10"  type="text" value="{$bookinfo.title2}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">书写文章</label>
        <div class="col-sm-9">
            <script id="editor" type="text/plain" name="content" style="width:830px;height:500px;">{$bookinfo.content}</script>
        </div>
    </div>

    <div class="clearfix form-actions">
        <div class="col-md-offset-3 col-md-9">
            <input type="hidden" name="id" value="{$bookinfo.id}">
            <button type="submit" class="btn btn-info" data-bind="click: submit, disable: submitting">保存</button>
        </div>
    </div>
</form>
<script>
    function geturl(){
        var url = $("input[name='sourceurl']").val();
        console.log(url);
        var data = {url:url};
        $.get("{:U('getContent')}",{data:data},function(resp){
            console.log(resp);
                var data = JSON.parse(resp);
                if(data.code==1){
                    alert(data.message);
                }else{
                    
                }
        });
    }
</script>
<script type="text/javascript">
$('#s1').change(function(event) {
    var $tid = $(this).val();
    $('#s2').empty();
    $.get('__URL__/changebook',{'tid':$tid},function(data) {
        $('#s2').append('<option value="">---请选择---</option>')
        if(data != 'error')
        {
            $.each(data, function(key, val) {
                $('#s2').append('<option value="'+val.id+'">'+val.title+'</option>');
            });
        }
    });
});
$('#r2').click(function(event) {
    $('#goldshow').css('display','block');
    //alert(1);
});
$('#r1').click(function(event) {
    $('#goldshow').css('display','none');
    //alert(1);
});
</script>


                                <!-- PAGE CONTENT ENDS -->
                            </div><!-- /.col -->
                        </div><!-- /.row -->
                    </div><!-- /.page-content-area -->
                </div><!-- /.page-content -->
            </div><!-- /.main-content -->

        </div><!-- /.main-container -->
        <script src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.webui-popover.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.ui.widget.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.fileupload.min.js"></script>

        <!-- page specific plugin scripts -->

        <!-- ace scripts -->
        <script src="__PUBLIC__/admin/js/ace-elements.min.js"></script>
        <script src="__PUBLIC__/admin/js/ace.min.js"></script>
        <script src="__PUBLIC__/admin/js/elements.onpage-help.js"></script>
        <script src="__PUBLIC__/admin/js/ace.onpage-help.js"></script>
    <!-- 文本编辑器部分 -->



<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script>

<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"> </script>



<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->



<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->



<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
    
</script>

<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');
    function isFocus(e){
    alert(UE.getEditor('editor').isFocus());
    UE.dom.domUtils.preventDefault(e)
    }
    function setblur(e){
        UE.getEditor('editor').blur();
        UE.dom.domUtils.preventDefault(e)

    }
    function insertHtml() {
        var value = prompt('插入html代码', '');
        UE.getEditor('editor').execCommand('insertHtml', value)
    }
    function createEditor() {
        enableBtn();
        UE.getEditor('editor');
    }
    function getAllHtml() {
        alert(UE.getEditor('editor').getAllHtml())
    }

    function getContent() {
        var arr = [];
        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
        arr.push("内容为：");
        arr.push(UE.getEditor('editor').getContent());
        alert(arr.join("\n"));
    }



    function getPlainTxt() {
        var arr = [];
        arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
        arr.push("内容为：");
        arr.push(UE.getEditor('editor').getPlainTxt());
        alert(arr.join('\n'))
    }



    function setContent(isAppendTo) {
        var arr = [];
        arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
        UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
        alert(arr.join("\n"));
    }



    function setDisabled() {



        UE.getEditor('editor').setDisabled('fullscreen');



        disableBtn("enable");



    }







    function setEnabled() {



        UE.getEditor('editor').setEnabled();



        enableBtn();



    }







    function getText() {



        //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容



        var range = UE.getEditor('editor').selection.getRange();



        range.select();



        var txt = UE.getEditor('editor').selection.getText();



        alert(txt)



    }

    function getContentTxt() {



        var arr = [];



        arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");



        arr.push("编辑器的纯文本内容为：");



        arr.push(UE.getEditor('editor').getContentTxt());



        alert(arr.join("\n"));



    }


    function hasContent() {



        var arr = [];



        arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");



        arr.push("判断结果为：");



        arr.push(UE.getEditor('editor').hasContents());



        alert(arr.join("\n"));



    }



    function setFocus() {



        UE.getEditor('editor').focus();



    }



    function deleteEditor() {



        disableBtn();



        UE.getEditor('editor').destroy();



    }



    function disableBtn(str) {



        var div = document.getElementById('btns');



        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");



        for (var i = 0, btn; btn = btns[i++];) {



            if (btn.id == str) {



                UE.dom.domUtils.removeAttributes(btn, ["disabled"]);



            } else {



                btn.setAttribute("disabled", "true");



            }



        }



    }



    function enableBtn() {



        var div = document.getElementById('btns');



        var btns = UE.dom.domUtils.getElementsByTagName(div, "button");



        for (var i = 0, btn; btn = btns[i++];) {



            UE.dom.domUtils.removeAttributes(btn, ["disabled"]);



        }



    }







    function getLocalData () {



        alert(UE.getEditor('editor').execCommand( "getlocaldata" ));



    }







    function clearLocalData () {



        UE.getEditor('editor').execCommand( "clearlocaldata" );



        alert("已清空草稿箱")



    }

</script>

</body>
</html>
